package com.nansu.controller;

import com.nansu.entity.Student;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
@RequestMapping("/student")
public class MyController4 {

    //添加学生
    @RequestMapping(value = "/{id}",method = RequestMethod.POST)
    public String addStudent(@PathVariable("id") int id, Student student){
        System.out.println(student);
        System.out.println("新增学生");
        return "info";
    }

    //删除学生
    @RequestMapping(value = "/{id}",method = RequestMethod.DELETE)
    public String deleteStudentById(@PathVariable("id") int id){
        System.out.println("删除学生");
        return "info";
    }

    //修改学生信息
    @RequestMapping(value = "/{id}",method = RequestMethod.PUT)
    public String updateStudent(@PathVariable("id") int id,Student student){
        System.out.println(student);
        System.out.println("修改学生");
        return "info";
    }

    //查询学生信息
    @RequestMapping(value = "/{id}",method = RequestMethod.GET)
    public String selectStudentById(@PathVariable("id") int id){
        System.out.println("查询学生");
        return "info";
    }




}
